package json;


import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import com.google.gson.Gson;

public class JSONExample {

	
	public static void main(String[] args) throws FileNotFoundException {
		Gson gson = new Gson();
		System.out.println(gson.toJson(null));
		System.out.println(gson.toJson(new Object[]{"Misho", "Gena", "Vesko", "Georgi", "Stoiko", 5}));
		
		Enum daysOfWeek = Enum.FRIDAY;
		System.out.println(daysOfWeek.ordinal()); // wry6ta nomera na denq
		
		Person mara = new Person();
		mara.setPhone("08984444");
		mara.setName("Maria");
		
		List<String> alcohol = new ArrayList<String>();
		Collections.addAll(alcohol, "rakiq", "bira", "Whiskey", "menta");
		ArrayList<Integer>listq = new ArrayList<Integer>();
		Collections.addAll(listq, 2,10,223,7);
		for (int i = 0; i < alcohol.size(); i++ ) {
			
		}
		
		PrintWriter wr = new PrintWriter(new File("Mara.json"));
		wr.write(gson.toJson(mara));
		wr.close();
		
//		new PrintWriter(new File("Mara.json").write(gson.toJson(mara)));
//		
//		System.out.println(gson.toJson(alcohol));
//		Person maraAgain= gson.fromJson(json, Person.class);
		
	}

}
